Public Class Frm_Print

    Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim topMargin = e.PageSettings.Margins.Top
        Dim leftMargin = e.PageSettings.Margins.Left
        Dim linesPerPage As Single = 0
        Dim verticalPosition As Single = 0
        Dim horizontalPosition As Single = leftMargin
        Dim textLine As String = Nothing
        Dim currentLine As Integer = 0
        'linesPerPage = e.MarginBounds.Height / myFont.GetHeight(e.Graphics)

        'If currentLine < TextBox1.Lines.Length Then
        '    While currentLine < linesPerPage
        '        textLine = TextBox1.Lines(currentLine)
        '        verticalPosition = topMargin + currentLine * myFont.GetHeight(e.Graphics)

        '        e.Graphics.DrawString(textLine, myFont, myBrush, horizontalPosition, verticalPosition)
        '        currentLine += 1
        '    End While
        'Else
        '    textLine = Nothing
        'End If
        ' If more lines of text exist in the file, print another page
        If Not (textLine Is Nothing) Then
            e.HasMorePages = True

        Else
            e.HasMorePages = False

        End If
        Me.PrintDocument1.Print()

    End Sub
End Class